//
//  MKLineComicListTableViewCell.m
//  ManKeCartoon
//
//  Created by 邹功梁 on 15/10/22.
//  Copyright © 2015年 ManKe. All rights reserved.
//

#import "MKLineComicListTableViewCell.h"

@implementation MKLineComicListTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        _listLabel = [[UILabel alloc] initWithFrame:CGRectMake(10, 10 * HEIGHT, SCREEN_WIDTH - 20, 40 * HEIGHT)];
        
        [_listLabel setTextColor:[UIColor blackColor]];
        [_listLabel setFont:[UIFont systemFontOfSize:14.]];
        [_listLabel setTextAlignment:NSTextAlignmentLeft];
        
        _grayLineView = [[UIView alloc] initWithFrame:CGRectMake(0, 60 * HEIGHT - 1, SCREEN_WIDTH, 1)];
        [_grayLineView setBackgroundColor:[UIColor colorWithRed:0.95 green:0.95 blue:0.95 alpha:1]];
        
        _orangeView = [[UIView alloc] initWithFrame:CGRectMake(0, 20 * HEIGHT, 5, 20 * HEIGHT)];
        [_orangeView setBackgroundColor:[UIColor orangeColor]];
        [self.contentView addSubview:_orangeView];
        [self.contentView addSubview:_listLabel];
        [self.contentView addSubview:_grayLineView];
    }
    return self;
}
- (void)setListModel:(MKLineComicListModel *)model
{
    NSString *text = [NSString stringWithFormat:@"第%@话  - %@", model.seq, model.title];
    NSMutableAttributedString *attributedStr = [[NSMutableAttributedString alloc] initWithString:text];
    [attributedStr addAttribute:NSForegroundColorAttributeName value:[UIColor grayColor] range:NSMakeRange(text.length - model.title.length - 4, model.title.length + 4)];
    [_listLabel setAttributedText:attributedStr];
}

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
